package com.iflytek.crvoice2txt.present;

import android.content.Context;

import com.iflytek.crvoice2txt.activity.RecordSignView;
import com.iflytek.crvoice2txt.entity.RecorderEntity;
import com.iflytek.crvoice2txt.model.RecordSignBiz;
import com.iflytek.crvoice2txt.model.RecordSignBizImpl;

import java.util.List;

public class RecoderSignPresentImpl implements RecoderSignPresent, RecoderSignPresent.OnVoiceDictationFinished {

    private Context context;
    private RecordSignBiz recordSignBiz;
    private RecordSignView recordSignView;

    public RecoderSignPresentImpl(RecordSignView recordSignView, Context context) {
        this.context = context;
        this.recordSignView = recordSignView;
        recordSignBiz = new RecordSignBizImpl(context, this);
    }

    @Override
    public void doErrroInit(int errorcode) {
        recordSignView.doErrroInit(errorcode);
    }

    @Override
    public void showToast(String str) {
        recordSignView.showToast(str);
    }

    @Override
    public void dicationFinished(RecorderEntity recorderEntity) {
        recordSignView.dicationFinished( recorderEntity);
    }

    @Override
    public void saveTextToDbFinished(Boolean b) {
        recordSignView.saveTextToDbFinished(b);
    }

    @Override
    public void countDown(int second) {
        recordSignView.countDown(second);
    }

    @Override
    public void onQueryAllAsyn(List<RecorderEntity> list) {
        recordSignView.onQueryAllAsyn(list);
    }

    @Override
    public void onAudioPlayFinished() {
        recordSignView.onAudioPlayFinished();
    }

    @Override
    public void startVoiceDictation() {
        recordSignBiz.startVoiceDictation();
    }

    @Override
    public void stopVoiceDictation() {
        recordSignBiz.stopVoiceDictation();
    }

    @Override
    public void cancelVoiceDictation() {
        recordSignBiz.cancelVoiceDictation();
    }

    @Override
    public void onResume() {
        recordSignBiz.onResume();
    }

    @Override
    public void onPause() {
        recordSignBiz.onPause();
    }

    @Override
    public void onDestroy() {
        recordSignBiz.onDestroy();
    }

    @Override
    public String getEtText() {
        return recordSignView.getEtText();
    }

    @Override
    public void saveText(RecorderEntity recorderEntity) {
        recordSignBiz.saveText(recorderEntity);
    }

    @Override
    public void startPlayAudio(String path) {
        recordSignBiz.startPlayAudio(path);
    }

    @Override
    public void stopPlayAudio() {
        recordSignBiz.stopPlayAudio();
    }

    @Override
    public void getSaveList() {
        recordSignBiz.getSaveList();
    }


}
